home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / perlnt.zip / t / comp / opts.nt < prev    next >
Text File  |  1993-07-25  |  1KB  |  53 lines

  1.  
  2. print "1..5\n";
  3.  
  4. #
  5. # test -a command line option
  6. #
  7.  
  8. $x = `echo 1 2 3 4 5 | perl -nae 'print ((\$F[4] == 5) ? "ok": "not ok");'`;
  9.  
  10. print $x, " 1\n";
  11.  
  12.  
  13. #
  14. # test the -l (line end processing) option
  15. #
  16.  
  17. $x = `perl -l014 -e 'print "ok" if (\$\\ eq "\014");'`;
  18. chop $x;
  19. if ("$x" eq "ok") {print "ok 2\n";} else {print "not ok 2\n";}
  20.  
  21.  
  22. #
  23. # test the -0 (record terminator) option
  24. #
  25.  
  26. $x = `echo 1 2 3 4 | perl -0040 -l012 -ne 'print;'`;
  27. @x =  $x ne '' ? split ('\n', $x) : ();
  28. if (@x == 4 && $x[0] eq "1") {print "ok 3\n";} else {print "not ok 3\n";}
  29.  
  30. #
  31. # test the -w option
  32. #
  33. open (T, ">foo$$") || die "Can't open foo$$ for writing: $!\n";
  34. print T 'print "$^W";';
  35. close T;
  36. $x = `perl -w foo$$`;
  37. unlink foo$$;
  38. if ($x eq "1") {print "ok 4\n";} else {print "not ok 4 ($x)\n";}
  39.  
  40. open (T, ">foo$$") || die "Can't open foo$$ for writing: $!\n";
  41. print T '$c = 1;';
  42. close T;
  43. $x = `perl -w foo$$ 2>&1`;
  44. if ($x =~ /^Possible typo/) {print "ok 5\n";} else {print "not ok 5\n";}
  45. unlink foo$$;
  46.  
  47. #
  48. # test the -s command line option
  49. #
  50.  
  51.  
  52.  
  53.